
(function () {
    var opendtitle = document.querySelector('.open');
    var title_box = document.querySelector('.title-box');
    var send = document.querySelector('.send');
    var comment = document.querySelector('.comment');
    // opendtitle.addEventListener('mouseenter', function () {
    //     title_box.style.display = "inline-block";
    //     console.log("点击了");
    // })
    // opendtitle.addEventListener('mouseleave', function () {
    //     title_box.style.display = "none";
    //     console.log("离开了");
    // })
    opendtitle.addEventListener('click', function () {
        title_box.style.display = "inline-block";
        title_box.focus();
        send.style.display = "block";
        console.log("点击了");
    })

    title_box.addEventListener('blur', function () {
        title_box.style.display = "none";
        // send.style.display = "none";
        console.log("取消了");
    })

    send.addEventListener('click', function () {
        if (title_box.value == "") {
            alert("要写入内容哦！")
        }
        else {
            var p = document.createElement('p');
            p.innerHTML = title_box.value;
            comment.appendChild(p);
            console.log("我被点击；额");
            console.log("y" + title_box.value);
            title_box.value = "";
        }



    })


})();